package cn.zt.service.impl;

import cn.zt.common.Result;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.zt.domain.Examine;
import cn.zt.service.ExamineService;
import cn.zt.mapper.ExamineMapper;
import org.springframework.stereotype.Service;

/**
* @author asus
* @description 针对表【examine】的数据库操作Service实现
* @createDate 2024-09-03 18:54:30
*/
@Service
public class ExamineServiceImpl extends ServiceImpl<ExamineMapper, Examine>
    implements ExamineService{

    @Override
    public Result selectByNameAndId(Examine examine) {
        Examine one = this.getOne(Wrappers.<Examine>lambdaQuery().eq(Examine::getName, examine.getName())
                .eq(Examine::getIdNumber, examine.getIdNumber())
                .eq(Examine::getPhone,examine.getPhone()));
        if(one==null){
            return Result.error();
        }
        return Result.success(one);
    }

    @Override
    public Result selectByThree(Examine examine) {
        LambdaQueryWrapper<Examine> eq = Wrappers.<Examine>lambdaQuery().eq(Examine::getName, examine.getName())
                .eq(Examine::getIdNumber, examine.getIdNumber())
                .eq(Examine::getPhone, examine.getPhone());
        Examine one = this.getOne(eq);
        return Result.success(one);
    }
}




